import type {
  OrderRefund,
  OrderRefundExportQuery,
  OrderRefundQuery,
} from './model';

import type { PageResult } from '#/api/common';

import { requestClient } from '#/api/request';

enum Api {
  orderRefundExport = '/orderRefund/v1/orderRefundExport',
  orderRefundList = '/orderRefund/v1/pageList',
}

/**
 * 退款对账分页列表
 * @param data 请求参数
 * @returns 列表
 */
export function orderRefundList(
  data?: OrderRefundQuery & { pageNo?: number; pageSize?: number },
) {
  return requestClient.post<PageResult<OrderRefund>>(Api.orderRefundList, data);
}

/**
 * 导出退款对账
 * @param data 请求参数
 */
export function orderRefundExport(
  data?: OrderRefundExportQuery & { pageNo?: number; pageSize?: number },
) {
  return requestClient.post<Blob>(Api.orderRefundExport, data, {
    data,
    isTransformResponse: false,
    responseType: 'blob',
  });
}
